Skip to main content

Replicating ESP-Sensor-Mesh

11/23/2022 We faced issues in the following steps:

  1. Setting up xRDP - The screen was blank after logging into Ubuntu machine through Windows Remote Desktop.
  2. ESP-IDF VSCode extension gave errors - VSCode extension hangs when running esp-idf commands. Suspect there is a configuration issue.

Devices used in the original setup

Doesn't necessarly mean these would need to be same. Just pay attention to any platform specific steps, if any.

Computers

  1. Windows 11 machine
  2. Ubuntu 20.04LTS machine

ESP32 devices

  1. ESP32S3 as the root node
  2. ESP32 (generic ESP32, D, S2, C3) are used as intermediate nodes and sensor nodes.

Sensors

  1. lis3dh Accelerometer.
  2. BME280 pressure sensor.
  3. Dallas temperature sensor.

Steps to follow

Prerequisites

  1. Have github.com account with access to gqc repos.

Windows

  1. install git
  2. Setup Git SSH keys (link)
  3. Install VSCode.
    1. Make sure you tick add vscode shortcut to context menu settings while isntallation.

Linux

  1. instal xdrp (Check the Setup RDP to Ubuntu machine from Windows section in this document)
  2. install open-ssh
  3. Setup git SSH in ubuntu (link)

Set up ESP-IDF in Windows 11 machine

  1. Install ESP-IDF version 4.4.2 from here. More info can be found here. Default installation location is C:/espressif/. Select the correct installation version
  2. If the setup asks you to select the boards to support, select all.
  3. Finish the setup.
  1. (Optional) If you want to develop ESP-IDF code with VSCode,

    1. Install VSCode.
    2. In VSCode, goto extentions and then install Espressif IDF extension.
    3. Ctrl+Shift+P and type ESP-IDF: Configure ESP-IDF Extension. Follow along the configuration steps to setup the extention.

Clone the ESP repos (to windows machine)

  1. We organize our internal git repos at C:\git\gqc\ folder.

  2. clone these repos:

    1. Code for root and intermediate nodes.
    2. Code for sensor nodes.
  3. Checkout the README.md files in the repos for more information on configuration.

  4. Flash the code into your devices.

    1. Plug in the ESP32 device via USB.

    2. Open up ESP-IDF command prompt via start menu or desktop shortcut.

    3. Go into the repo directory.

    4. We will use idf.py tool to flash the code to device. The help menu can be invoked by idf.py --help

    5. Check the available target devices through

      idf.py --list-targets
    6. Select target. (esp32, esp32s3 etc.)

      idf.py set-target esp32
    7. Open up menuconfig and configure the node as desired.

      idf.py menuconfig

      Eg: menuconfig menuconfig2

    8. Build the code.

      idf.py build
    9. Flash the code. Put the correct COM port (eg: COM4)

      idf.py -p <COMPORT> flash

      You can check the comport name by device manager. com port

    10. Monitor the serial port

      idf.py monitor

Clone the Socket Server repo (to Ubuntu machine)

  1. To connect to the ubuntu machine remotely we can use VSCode remote development feature.
    • In Windows, open VSCode and install the extension, Remote - SSH. remote ssh extension
    • Ctrl+Shift+P to open the command pallet. Then type Remote-SSH: Add new SSH hostremote host
    • type in your username@ip of ubuntu machineip addr
    • Finally Ctrl+Shift+P, and Remote-SSH: Connect to host and select the config we created in the earlier step. connect to remote
  2. We organize our internal git repos at User_home_dir/git/gqc/ folder in linux.
  3. Clone socket server repo
  4. Follow the README.md to run the socket server.

Setup RDP to Ubuntu machine from Windows

  1. Installing xRDP in Ubuntu:

    1. Run the commands:

      sudo apt install xrdp
      sudo systemctl enable xrdp
    2. Restart the machine

  2. Connect to the ubuntu laptop via Remote Desktop Connection in Windows 11.

    1. Enter the ubuntu laptop IP.
    2. If at first doesn't work try these settings in Windows Remote Desktop settings: rdp